var app = getApp();
var api = require("../../utils/api.js");
var util= require("../../utils/libs.js");

Page({
  data: {
    avatar:{},
  },
  submit () {
    wx.reLaunch({
      url: '../index/index',
    })    
  },
  getUserInfo(){
    let that = this
     let id = wx.getStorageSync('uid')
    util.request(api.userInfo,{
      uid:id
    },
    "GET")
    .then(function (res) {
      if(res.error_code === 0){
        console.log(res)
        that.setData({
          avatar:res.data.user
        })
      }
    })
  },
  onLoad (options) {
    let that = this
    that.getUserInfo()
    // 页面初始化 options为页面跳转所带来的参数
  },
  onReady () {
    // 页面渲染完成
  },
  onShow () {
    // 页面显示
  },
  onHide () {
    // 页面隐藏

  },
  onUnload () {
    // 页面关闭

  }
})
